private Bitmap GetScreenShot() { Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bmp); g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy); return bmp; } private void Startlistener() { TcpListener listener = new TcpListener(port); listener.Start(); while (true) { if (isFormClosed) { return; } try { TcpClient client = listener.AcceptTcpClient(); if (clientList.Count < maxConnections) { clientList.Add(client); } else { client.Close(); } } catch (Exception ex) { this.Text = ex.Message; } } }
评论